﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/QuizAdmin.Master" AutoEventWireup="true" CodeBehind="EditQuestionLevels.aspx.cs" Inherits="BladeTecWebApplication.Admin.EditQuestionLevels" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style2
        {
            width: 106px;
        }
        .style4
        {
        }
    </style>
<script type="text/javascript">

	function confirmDelete(confirmed) {

		if (Page_ClientValidate()) {
			$("#divRequired").hide();
		} else {
			$("#divRequired").show();
			return;
		}

		var weight = $("#MainContent_hfWeight").val();
		var newWeight = $("#MainContent_txtlevelWeight").val();

		if (newWeight == weight) {
			return true;
		}

		if (!confirmed) {
			$("#dialog-confirm").dialog({
				resizable: false,
				height: 200,
				width: 400,
				modal: true,
				buttons: {
					"Yes": function () {
						$(this).dialog("close");
						$("#MainContent_deleteButtonHidden").click();
					},
					No: function () {
						$(this).dialog("close");
					}
				}
			});
			return false;
		} else {
			return true;
		}

	}

</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <span class="pageTitle">Edit Question Level</span><br />
	<br />


<asp:Panel ID="pnlQuestionLevelForm" runat="server" Width="315px">

	<asp:Panel runat="server" ID="pnlNumericError" Visible="false">
		<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;"> 
			<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span> 
			<strong>Error:</strong> The level weight must be a numeric decimal value.</p>
		</div>
	</asp:Panel>
	<div style="color: Red; display:none" id="divRequired">
	* Required<br /><br />
	</div>
	<table style="border: 0px none;">
		<tr>
			<td class="style2">
				Level Description:<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtlevelDescription" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator></td>
			<td>
				<asp:TextBox ID="txtlevelDescription" runat="server" CssClass="stdTextBox" 
					MaxLength="30" ViewStateMode="Disabled" Width="189px"></asp:TextBox>
			</td>
		</tr>
		<tr>
			<td colspan="2">&nbsp;</td>
		</tr>
		<tr>
			<td class="style2">
				Level Weight:<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtlevelWeight" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator></td>
			<td class="style4" style="padding-bottom:5px;">
				<asp:TextBox ID="txtlevelWeight" runat="server" CssClass="stdTextBox" 
					Width="71px" ClientIDMode="Predictable"></asp:TextBox>
			</td>
		</tr>
		<tr>
			<td colspan="3" style="text-align:right; border-top: 1px solid #666;">
				<br />
				<asp:HiddenField ID="hfLevelId0" runat="server" />
				<asp:Button ID="btnEditQuestionLevel" runat="server" 
					onclick="btnEditQuestionLevel_Click" Text="Save" OnClientClick="return confirmDelete(false);" />
				<div style="display:none">
					<asp:Button runat="server" OnClick="btnEditQuestionLevel_Click" ID="deleteButtonHidden" ClientIDMode="Predictable"/>
				</div>
			</td>
		</tr>
	</table>
	<div id="dialog-confirm" title="Confirm Weight Change" style="display:none;">
        <p>
            <span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;">
            </span>Are you sure you want to change the level weight? Changing the weight could affect existing attempt comparisons.</p>
    </div>
	<asp:HiddenField ID="hfWeight" runat="server" ClientIDMode="Predictable" />
</asp:Panel>

<asp:Panel ID="pnlConfirmationForm" runat="server" Visible="False">
	    
	The level was successfully updated.
	<br /><br />
	<a class="dashboardLink" href="Levels.aspx">View Levels</a>

</asp:Panel>

</asp:Content>